Skip to content

feat: add Superserve sandbox backend#3502

Open
meAmitPatil wants to merge 5 commits into
openai:mainfrom
superserve-ai:superserve-extension
Open

feat: add Superserve sandbox backend#3502
meAmitPatil wants to merge 5 commits into
openai:mainfrom
superserve-ai:superserve-extension

Conversation

@meAmitPatil
Copy link
Copy Markdown

Summary

Adds a Superserve-backed sandbox provider under agents.extensions.sandbox.superserve, following the existing hosted sandbox extension pattern. The provider is exposed through the optional superserve extra and uses the superserve Python SDK to create, resume, execute in, and clean up sandboxes.

Superserve is a Firecracker-microVM-based sandbox platform with sub-second cold starts and native pause/resume.

Supported features

  • SuperserveSandboxClient / SuperserveSandboxClientOptions for creating sandboxes from curated templates (e.g. superserve/base, superserve/python-3.11, superserve/node-22).
  • SuperserveSandboxSession / SuperserveSandboxSessionState for serialized run-state resume.
  • Command execution through Commands.run, including streaming output via the SDK's SSE callbacks; timeout and transport errors map to ExecTimeoutError / ExecTransportError.
  • Workspace read/write through Files.read / Files.write, with WorkspaceReadNotFoundError on missing files and transient-error retries on writes.
  • Tar-based persist_workspace / hydrate_workspace via shell tar over exec.
  • Native pause-on-exit via pause_on_exit=True, and client.resume(state) that reattaches via AsyncSandbox.connect(sandbox_id), calls sandbox.resume() when the sandbox is paused, polls get_info() until status == active, and falls back to recreating on not_found / failed / unknown statuses.
  • Lazy optional exports from agents.extensions.sandbox so users without the extra can still import the package.

Testing

  • 27 unit tests in tests/extensions/sandbox/test_superserve.py mirroring the coverage shape of other sandbox providers: lifecycle, exec error translation (timeout / transport / conflict), path-escape rejection, workspace tar round-trip, all four resume status branches (active, paused, resuming, failed, unknown → recreate), sandbox-local user rejection, runtime-helper cache key.
  • Updated tests/sandbox/test_compatibility_guards.py with surface, option/state field-order, and round-trip parametrize entries for the new types.
  • Updated tests/sandbox/test_client_options.py round-trip parametrize with a SuperserveSandboxClientOptions(template=\"superserve/base\") instance.
  • `make lint`, `make format`, `make typecheck`, full sandbox test suite (594 tests) pass locally.
  • Live-verified end-to-end against a production Superserve account via examples/sandbox/extensions/superserve_runner.py, in both default (kill-on-exit → recreate → hydrate from local tar) and --pause-on-exit (reattach → sandbox.resume() → poll until active) flows.

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run `make lint` and `make format`
  • I've made sure tests pass

@meAmitPatil meAmitPatil marked this pull request as ready for review May 25, 2026 23:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc707cec64

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/extensions/sandbox/superserve/sandbox.py Outdated
Comment thread src/agents/extensions/sandbox/superserve/sandbox.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75c94b909d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/extensions/sandbox/superserve/sandbox.py
Comment thread src/agents/extensions/sandbox/superserve/sandbox.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants